package sia.tpIntro;

public class Problem {

	//GroupNumber
	private static final Integer GN = 2;
	//Bounds
	private static double lowerBound = 0;
	private static double upperBound = 1;
	
	private static Double function( Double x ) {
		return 0.1*GN + Math.sin(x*5*GN*Math.PI)*0.1*GN + x*0.2*GN;
	}
	
	static public Double maximize(Genotype genotype) {
		//Si se va de las bandas lo pondero mal para descartarlo
		if( genotype.getFenotype() < lowerBound || genotype.getFenotype() > upperBound )
			return lowerBound;
		
		return function( genotype.getFenotype() );
	}
	
	static public Double minimize(Genotype genotype) {
		//Si se va de las bandas lo pondero mal para descartarlo
		if( genotype.getFenotype() < lowerBound || genotype.getFenotype() > upperBound )
			return lowerBound;
		
		return 1/function(  genotype.getFenotype()  );
	}
	
}
